package com.test.resumeanalysis.ui.post

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.test.resumeanalysis.R
import com.test.resumeanalysis.common.BaseVBFragment
import com.test.resumeanalysis.data.model.JobPost
import com.test.resumeanalysis.databinding.FragmentPostBinding


class PostFragment :BaseVBFragment<FragmentPostBinding>(FragmentPostBinding::inflate){

    private val postViewModel:PostViewModel by viewModels()

    override fun initView() {
        super.initView()


        binding.btnSave.setOnClickListener {
            val name = binding.tvTitle.text.toString()
            val require = binding.tvRequireInfo.text.toString()
            val duty = binding.tvDutyInfo.text.toString()
            val wages = binding.tvWagesFirst.text.toString()+"-"+binding.tvWagesLast.text.toString()+"K"
            val jobPost = JobPost(null,name,require,duty,wages)
            postViewModel.savePost(jobPost)
        }

    }
}